<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>GO机网管理后台</title>
	<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">
	<link href="../../css/bootstrap.min.css" rel="stylesheet">
	<link href="css/nifty.min.css" rel="stylesheet">
	<link href="../../css/demo/nifty-demo-icons.min.css" rel="stylesheet">
	<link href="../../plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	<link href="../../css/user_defined.css" rel="stylesheet">
	<link href="../../plugins/pace/pace.min.css" rel="stylesheet">
	<script src="../../plugins/pace/pace.min.js?2016/8/5"></script>
	<script src="../../js/jquery-2.2.1.min.js"></script>
	<script src="../../js/bootstrap.min.js"></script>
	<style>
		table {
			width: 100%;
			color: #999;
		}
		
		td {
			padding: 20px;
			vertical-align: middle!important;
		}
		
		td div{
			padding:5px 0;
			font-size:16px;
		}
		
		td:last-child:not(:first-child) {
			text-align: right;
		}
		select{
			padding:5px;
			margin-right:20px;
		}
		.btn-group{
			margin-right:30px;
		}
		img{
			width:50px;
			height:50px;
		}
	</style>
</head>

<!--TIPS-->
<!--You may remove all ID or Class names which contain "demo-", they are only used for demonstration. -->

<body id="main">
<div id="container" class="effect mainnav-lg">
	@@include('public/header.html')
	<div class="boxed">
		<div id="content-container">
			<div id="page-title">
				<h1 class="page-header text-overflow">机友提现审核</h1>
			</div>
			<div id="page-wrapper" style="margin-top:30px;">
				<div class="col-sm-8">
					<div class="btn-group" id="btn">
						<button v-on:click="loadList(page, 0, type)" class="btn btn-default" v-bind:class="{active:status=='0'}">未审核</button>
						<button v-on:click="loadList(page, 1, type)" class="btn btn-default" v-bind:class="{active:status=='1'}">已审核</button>
					</div>
				</div>
				<div class="col-sm-4 text-right">
					<button class="btn btn-primary" v-on:click="loadList(page-1, status, type)" v-show="page>1">上一页</button>
					<button class="btn btn-primary" v-on:click="loadList(page+1, status, type)" v-show="nextPage">下一页</button>
				</div>
			</div>
			<div class="col-sm-12 pad-btm pad-top">
				<table class="table table-striped" id="table">
					<tr v-for="l in list">
						<td width="80"><img src="{{l.user.img_url}}" alt="" /></td>
						<td>
							<div><span>微信昵称：</span><span v-text="l.user.nickname"></span></div>
							<div><span>机友编号：</span><span v-text="l.user.uid"></span></div>
						</td>
						<td>
							<div><span>提现金额：</span><span v-text="l.a_money"></span></div>
							<div><span>申请时间：</span><span v-text="l.a_date_format"></span></div>
						</td>
						<td>
							<button v-if="l.a_audit_status==0" class="btn btn-default" v-on:click="openModel(l);">确认通过</button>
						</td>
					</tr>
				</table>
			</div>
		</div>
		
		<nav id="mainnav-container">
			@@include('public/left_menu.html')
		</nav>
	</div>
	
	
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title" id="myModalLabel">确认</h4>
				</div>
				<div class="modal-body" style="text-align: center;font-size:22px;">
					<span>确认同意 </span>
					<span v-text="item.m_name" style="color:red;"></span>
					<span style="color:red;">
						<span v-text="item.a_money"></span>
						<span>元</span>
					</span>
					<span> 的提现申请？</span>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" id="addBrand" v-on:click="pass()">确定添加</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</div>
</div>
@@include('public/footer.html')
<script>
var vue = new Vue({
	el:"#main",
	data:{
		list:[],
		item:null,
		status:0,
		page:1,
		nextPage:true,
		types:{
			"1":"城市合伙人",
			"2":"联盟商户",
			"3":"自有工程师",
			"4":"滴滴工程师"
		}
	},
	methods:{
		/*通过提现*/
		pass:function(){
			var index = layer.load(1, {shade: [0.5,'#555']});
			$.post(apiRecycle+"partner.php?m=Admin&c=Order&a=agreement_jy_withdraw", {
				aid:vue.item.aid
			}, function(res){
				layer.close(index);
				if(res.code==200){
					$("#myModal").modal("hide");
					vue.item = null;
					location.reload();
				} else {
					alert(res.message);
				}
				
			}, "json");
		},
		/*打开确认窗口*/
		openModel:function(item){
			vue.item = item;
			$("#myModal").modal("show");
		},
		
		loadList:function(page, status){
			var thiz = this;
			var index = layer.load(1, {shade: [0.5,'#555']});
			$.get(apiRecycle+"partner.php?m=Admin&c=Order&a=apply_withdraw_jy_list", {
				curPage:page,
				a_audit_status:status
			}, function(res){
				thiz.status = status;
				thiz.page = page;
				
				layer.close(index);
				thiz.list = res.data;
				if(thiz.list.length==0){
					thiz.nextPage = false;
				} else {
					thiz.nextPage = true;
				}
			}, "json");
		}
	},
	ready:function(){
		var thiz = this;
		/*加载提现申请列表.*/
		this.loadList(1, 0, 1);
	}
});
</script>
</body>
</html>
